#include "Mainwin.h"

#include <gtkmm/stackswitcher.h>

namespace Gnodroid {

    Mainwin::Mainwin() :
        Glib::ObjectBase("gnd_mainwin"),
        Gtk::Window()
    {

        this->builder = Gtk::Builder::create_from_resource("/org/gnome/Gnodroid/mainwin.ui");
        builder->get_widget("headerbar", headerbar);
        builder->get_widget("overview", overview);
        builder->get_widget("filemanager", filemanager);
        builder->get_widget("appmanager", appmanager);
        builder->get_widget("tools", tools);
        builder->get_widget("mainbox", mainbox);
            //stack = new Gtk::Stack();
        builder->get_widget("stack", stack);


        stack->add(*overview, "overview", "overview");
        stack->add(*appmanager, "appmanager", "appmanager");

        /*
        不在首页窗口实现文件管理
        */
        //stack->add(*filemanager, "filemanager", "filemanager");
        stack->add(*tools, "tools", "tools");



        Gtk::StackSwitcher* stack_switcher;
        builder->get_widget("stack_switcher", stack_switcher);
        stack_switcher->set_stack(*stack);

        set_titlebar(*headerbar);
        add(*mainbox);
  
    }

    Glib::RefPtr<Gtk::Builder>
    Mainwin::getBuilder()
    {
        return builder;
    }

}
